import request from '../../utils/request'

export function requestAdminlist () {
    return new Promise(resolve => {
        request.get('/admin/list').then(res => {
            resolve(res.data)
        })
    })
}

export function requestAddAdminlist (data) {
    return new Promise(resolve => {
        request.post('/admin/regist', data).then(res => {
            resolve(res.data)
        })
    })
}

export function requestFreezeAdmin (id, bool) {
    return new Promise(resolve => {
        request.post('/admin/freeze', {
            id,
            bool
        }).then(res => {
            resolve(res.data)
        })
    })
}

export function requestRemoveAdmin (id) {
    return new Promise(resolve => {
        request.post('/admin/remove', {
            id
        }).then(res => {
            resolve(res.data)
        })
    })
}

export function requestModifyAdmin (id, data) {
    return new Promise(resolve => {
        request.post('/admin/modify', {
            id,
            data
        }).then(res => {
            resolve(res.data)
        })
    })
}
